define('login',["jquery"],function($){
    var login={
        init:function(){
            if(localStorage.getItem("user") == "13546698741" && localStorage.getItem("pass") == "123456"){
                $("#username").val(localStorage.getItem("user"));
                $("#password").val(localStorage.getItem("pass"));
                $("#username,#password").css("background","#fbffc4");
                $("#jizhu").attr("checked","checked");
            }else{
                $("#username,#password").val("").css("background","#fff");
            }
            $("#username,#password").change(function(){
                if($("#username").val() == "13546698741"){
                    $("#username").next().show().text("√");
                }
                if($("#password").val() == "123456"){
                    $("#password").next().show().text("√");
                }
            });
            $(".submit").on("click",function(e){
                e.preventDefault();
                if($("#jizhu").prop("checked")){
                    localStorage.setItem("user","13546698741");
                    localStorage.setItem("pass","123456");
                    sessionStorage.setItem("zhusir","朱志宏");
                }else{
                    localStorage.removeItem("user");
                    localStorage.removeItem("pass");
                    localStorage.clear();
                }
                if($("#username").val() == "13546698741" && $("#password").val() == "123456"){
                    //console.log("成功");
                    $(".fixed").show();
                    setTimeout(function(){
                        window.location.href="index.html";
                    },1000);
                }else{
                    //console.log("失败");
                    if($("#username").val() !== "13546698741"){
                        $("#username").next().show().text("X");
                    }
                    if($("#password").val() !== "123456"){
                        $("#password").next().show().text("X");
                    }
                    return false;
                }
            //    ajax



            })
        }
    };
    return login;
});